﻿@{
    Layout = null;
}
@using Raffles.OA.Utility
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>莱佛士项目运营管理平台</title>
    <link rel="stylesheet" href="/Content/login/layui/css/layui.css">
    <link rel="stylesheet" href="/Content/login/css/login.css">
    <link id="layuicss-laydate" rel="stylesheet" href="/Content/login/layui/css/modules/laydate/default/laydate﹖v=5.3.1.css" media="all">
    <link id="layuicss-layer" rel="stylesheet" href="/Content/login/layui/css/modules/layer/default/layer﹖v=3.5.1.css" media="all">
    <link id="layuicss-skincodecss" rel="stylesheet" href="/Content/login/layui/css/modules/code﹖v=2.css" media="all">
    <link href="/Content/adminlte/css/AdminLTE.min.css" rel="stylesheet" />
</head>
<body>
    <!-- 粒子背景 -->
    <div id="particles-js">
        <canvas class="particles-js-canvas-el" width="1920" height="1080" style="width: 100%; height: 100%;"></canvas>
    </div>
    <!-- 登录表单 -->
    <form class="layui-form login-form layui-panel" autocomplete="off">
        <h1 class="login-title"> <img src="/Content/login/img/logo.png" alt="logo"> </h1>
        <h1 class="login-title" style="margin-bottom: 20px;"><span>莱佛士项目运营管理平台</span> </h1>
        <!-- 用户名 -->
        <div class="layui-form-item">
            <i class="layui-icon layui-icon-username"></i>
            <input type="text" name="username" placeholder="请输入登录账号" class="layui-input" lay-verify="required" lay-reqtext="请输入用户账号" value="administrator">
        </div>
        <!-- 密码 -->
        <div class="layui-form-item">
            <i class="layui-icon layui-icon-password"></i>
            <input type="password" name="password" placeholder="请输入登录密码" class="layui-input" lay-verify="required" lay-reqtext="请输入用户密码" value="2024@lschen">
        </div>
        <div class="layui-form-item">
            <button class="layui-btn layui-btn-normal layui-btn-fluid submit" id="submit" type="button" lay-submit="" lay-filter="login"> 系  统  登  录 </button>
        </div> 
    </form>
    <script src="/Content/login/layui/layui.js"></script>
    <script src="/Content/plugin/jquery/jquery.min.js"></script>
    <script src="/Content/login/js/particles.js"></script>
    <script src="/Content/plugin/jquery.blockUI/jquery.blockUI.min.js"></script>
    <script src="/Content/plugin/jquery.validation/jquery.validate.js"></script>
    <script src="/Content/plugin/jquery.validation/messages_zh.min.js"></script>
    <script src="/Content/plugin/jquery.validation/jquery.validate.extend.js"></script>
    <script src="/Content/framework/js/framework.min.js"></script>
    <script src="/Content/framework/js/framework-extension.js"></script>
    <script @*disable-devtool-auto*@ src="/Content/system/js/disable-devtool@latest.js"></script>
    <script>  
        layui.use(["form"], function () {
            const form = layui.form;
            //监听提交
            form.on("submit(login)", function (data) {

                var date = new Date();
                frame.ajax({
                    url: '@Url.Content("/Login/CheckLogin")',
                    type: "get",
                    data:
                    {
                        account: $('input[name="username"]').val(),
                        password: $('input[name="password"]').val()
                    },
                    beforeSend: function () { 
                        $('#submit').text('正在登录......');
                        $('#submit').attr("disabled", "disabled");
                        $('#submit').css('background', '#C0C0C0');
                    },
                    success: function (result) {
                        var timediff = new Date().getTime() - date.getTime();
                        if (result.success) {
                            layer.msg("登录成功！", { icon: 1, time: 1000 });
                            if (!frame.isMobile()) {
                                location.href = result.data;
                            } else {
                                location.href = '@CacheHelper.GetCache("AppHomePage")';
                            }
                        }
                        else {
                            layer.msg(result.message, { icon: 2, time: 2000 });
                            setTimeout(function () {
                                $('#submit').text(' 系  统  登  录 ');
                                $('#submit').removeAttr("disabled");
                                $('#submit').css('background', '#1E9FFF');
                            }, timediff <= 800 ? 800 : 0)
                        }
                    }
                });
            });
        });
        //按下回车登录
        $("body").on("keyup", (e) => {
            if (e.which === 13) {
                $("#submit").trigger("click");
            }
        });
    </script>
</body>
</html>